<%= form_for(Settings::General.new,
             url: admin_settings_general_settings_path,
             html: { data: { action: "submit->config#updateConfigurationSettings" } }) do |f| %>
  <details class="crayons-card">
    <summary class="crayons-subtitle-2 p-6">Images</summary>
    <div class="p-6 pt-0">
      <fieldset class="grid gap-4">
        <%= render partial: "admin/shared/logo_upload", locals: { f: f, allowed_types: logo_allowed_types, max_file_size: logo_max_file_size, logo: Settings::General.resized_logo } %>

        <div class="crayons-field">
          <%= admin_config_label :logo_png, "Secondary Logo" %>
          <%= admin_config_description Constants::Settings::General.details[:logo_png][:description] %>
          <%= f.text_field :logo_png,
                           class: "crayons-textfield",
                           value: Settings::General.logo_png,
                           placeholder: Constants::Settings::General.details[:logo_png][:placeholder] %>
          <% if Settings::General.logo_png.present? %>
            <img src="<%= Images::Optimizer.call(Settings::General.logo_png, width: 128) %>" width="128" height="128" loading="lazy" />
          <% end %>
        </div>

        <div class="crayons-field">
          <%= admin_config_label :main_social_image %>
          <%= admin_config_description Constants::Settings::General.details[:main_social_image][:description] %>
          <%= f.text_field :main_social_image,
                           class: "crayons-textfield",
                           value: Settings::General.main_social_image,
                           placeholder: Constants::Settings::General.details[:main_social_image][:placeholder] %>
          <% if Settings::General.main_social_image.present? %>
            <img alt="main social image" class="max-w-100 h-auto" src="<%= Settings::General.main_social_image %>" width="600" height="337" loading="lazy" />
          <% end %>
        </div>

        <div class="crayons-field">
          <%= admin_config_label :favicon_url, "Favicon URL" %>
          <%= admin_config_description Constants::Settings::General.details[:favicon_url][:description] %>
          <%= f.text_field :favicon_url,
                           class: "crayons-textfield",
                           value: Settings::General.favicon_url,
                           placeholder: Constants::Settings::General.details[:favicon_url][:placeholder] %>
          <img alt="favicon" class="preview" src="<%= Images::Optimizer.call(Settings::General.favicon_url, width: 32) %>" width="32" height="32" loading="lazy" />
        </div>

      </fieldset>
      <%= render "update_setting_button", f: f, aria_label: "Update image settings" %>
    </div>
  </details>
<% end %>
